package org.dudemonkey.thread.p188;

import lombok.extern.slf4j.Slf4j;


import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 不可理喻的——SimpleDateFormat 线程不安全
 */
@Slf4j
public class TestDateFormat {
    public static void main(String[] args) throws Exception {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        for (int i = 0; i < 10 ; i++) {
            new Thread(()->{
                try {
                    Date d = sdf.parse("2000-06-20");
                    log.debug("{}",d);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }).start();
        }
    }
}
